import 'package:flutter/material.dart';
import './loginEnter.dart';

class PicturePage extends StatefulWidget {
  const PicturePage({super.key});

  @override
  State<PicturePage> createState() => _PicturePageState();
}

class _PicturePageState extends State<PicturePage> {
  @override
  Widget build(BuildContext context) {
    return Center(
      child: ElevatedButton(
        child: const Text('回顶部路由'),
        onPressed: () {
          Navigator.of(context).pushAndRemoveUntil(
              // 返回到指定的路由 返回之后会把这个路由之前经过的页面路径清除，一般用来回到顶部路由
              MaterialPageRoute(builder: (context) => const LoginEnter()),
              // 清空路由
              // ignore: unnecessary_null_comparison
              (route) => route == null);
        },
      ),
    );
  }
}
